#include <iostream>
#include "Game.h"



using namespace std;



/**
 * Print out the environment of the Player
 * @param void
 * @return void
 */
void Game::printLocationInformation()
{
	m_currentMap->print(m_playerCoord.x, m_playerCoord.y);
	cout << "Position: (" << m_playerCoord.x << ", " << m_playerCoord.y << ")" << endl; 
	cout << "Terrain: " << m_currentMap->m_cells(m_playerCoord.x, m_playerCoord.y).getType() << endl;
	cout << "Description: " << m_currentMap->m_cells(m_playerCoord.x, m_playerCoord.y).getDesc() << endl;
}


/**
 * Gives the choice to the player
 * @param void
 * @return void
 */
char Game::printGameMenu()
{
	char choice;

	cout << "--<<O>>--<<O>>--<<O>>--<<O>>--<<O>>--<<O>>--<<O>>--<<O>>--" << endl;
	printLocationInformation();
	cout << "--<<O>>--<<O>>--<<O>>--<<O>>--<<O>>--<<O>>--<<O>>--<<O>>--" << endl << endl;
	cout << " What do you want to do?" << endl;
	cout << "1. [R]est" << endl;
	cout << "2. [M]ove" << endl;
	cout << "3. [E]quip weapon or armor" << endl;
	cout << "4. [P]rint character sheet" << endl;
	cout << endl;
	cout << "========================" << endl;
	cout << "H. Help" << endl;
	cout << "S. Save Character" << endl;
	cout << "Q. Quit" << endl;
	cout << endl;
	cout << "Your choice: ";
	cin >> choice;
	cout << endl;
	return choice;
}


/**
 * Process the choice of the Player and sets the correct state
 * @param char choice - 
 * @return void
 */
void Game::processGameMenu(char choice)
{
	switch (choice)
	{
	case '1':
	case 'r':
	case 'R':
		m_iState = GAME_STATE_REST;
		break;
	case '2':
	case 'm':
	case 'M':
		m_iState = GAME_STATE_MOVE;
		break;
	case '3':
	case 'e':
	case 'E':
		m_iState = GAME_STATE_EQUIPITEM;
		break;
	case '4':
	case 'p':
	case 'P':
		m_iState = GAME_STATE_PRINTCHAR;
		break;
	case 's':
	case 'S':
		m_iState = GAME_STATE_SAVE;
		break;
	case 'q':
	case 'Q':
		m_iState = GAME_STATE_QUIT;
		break;
	case 'h':
	case 'H':
		m_iState = GAME_STATE_PRINTHELP;
		break;
	default:
		system("cls");
		cout << "Choice does not exist." << endl;
		break;
	}
}
